{block name=body} 
{* Define the function *} 
{function name=render_list level=0 hasClasses=0} 
	{assign var='lastTerm' value=""}
	{foreach $items as $item}
		{if $item.url && ($admin.level eq 1 || $item.record.location_franchisee_id|in_array:$admin.franchisee) }
		{assign var='hasClasses' value=1}
		<!-- {if $lastTerm neq $item.term_name}
		<tr>
			<td colspan="5">
				<div style="font-size:23px;font-weight:bold;">{$item.term_name}</div>
			</td>
		</tr>
		{assign var='lastTerm' value=$item.term_name}
		{/if} -->
		<tr {if $item.published eq '0'}class="draft"{/if} data-state="{$item.location.CityName}" data-suburb="{$item.location.CountyName}" data-title="{$item.title}">
			<td>{for $var=1 to $level}- {/for}<b>{$item.title} [{$item.record.agegroup_shortname}]</b>{if $item.published eq '0'}<small>| 草稿</small>{/if}</td>
			<td>{if $item.record.location_name}{$item.record.location_name}{else}<span class="text-danger">没有设置教学地点</span>{/if}</td>
			<td>{if $item.term_name}{$item.term_name}{else}<span class="text-danger">没有设置学期</span>{/if}</td>
			<td>{if $item.url} <a href='{$item.url}' class='btn btn-small btn-warning pull-right'><span class="glyphicon glyphicon-pencil"></span> 编辑</a> {/if}
			</td>
			<td>{if $item.url_delete && $admin.level eq 1} <a href='{$item.url_delete}' onclick="return ConfirmDelete();" class='btn btn-small btn-danger pull-right'><span class="glyphicon glyphicon-trash"></span> 删除</a> {/if}
			</td>
		</tr>
		{/if}
		{if count($item.subs) > 0} {call name=render_list items=$item.subs level=$level+1 hasClasses=$hasClasses} {/if} 
	{/foreach} 
	{if $level eq 0 && $hasClasses eq 0} 
		<tr>
			<td colspan="5">{if $admin.level neq 1}您的加盟商下{/if}没有创建任何课程，或者没有创建学期以及设置学期对应的课程。</td>
		</tr>
	{/if}
{/function}

<div class="row ">
	<table class="table table-bordered table-striped table-hover">
		<thead>
			<tr>
				<th colspan="5">{$zone|upper} {if $admin.level eq 1}<a href="/admin/edit/{$path}" class='btn btn-small btn-success pull-right'><span class="glyphicon glyphicon-plus"></span> 添加课程</a>{/if}</th>
			</tr>
		</thead>
		<tbody>{call name=render_list items=$list}
		</tbody>
	</table>
</div>
{/block}
